using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using ComponentFactory.Krypton.Toolkit;
using DukeyCssFetch.api;

namespace DukeyCssFetch.UI
{
	// Token: 0x0200003A RID: 58
	public class ucTagExploer : UserControl
	{
		// Token: 0x06000259 RID: 601 RVA: 0x0001DACC File Offset: 0x0001BCCC
		public ucTagExploer()
		{
			
			this.InitializeComponent();
			this.method_0();
		}

		// Token: 0x0600025D RID: 605 RVA: 0x0001DEC8 File Offset: 0x0001C0C8
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x0600025E RID: 606 RVA: 0x0001DEE8 File Offset: 0x0001C0E8
		private void InitializeComponent()
		{
			this.icontainer_0 = new Container();
			this.toolTip_0 = new ToolTip(this.icontainer_0);
			base.SuspendLayout();
			base.AutoScaleDimensions = new SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			this.AutoScroll = true;
			base.Name = "ucTagExploer";
			base.Size = new Size(246, 703);
			base.ResumeLayout(false);
		}

		// Token: 0x0600025A RID: 602 RVA: 0x0001DAE8 File Offset: 0x0001BCE8
		private void method_0()
		{
			try
			{
				this.Text = "都客标签-模板编辑器   当前标签为:" + Comm.CurrentTag;
				string xmlFileName = Comm.root + "\\tag\\" + Comm.CurrentTag;
				XmlNode xmlNodeByXpath = XMLHelper.GetXmlNodeByXpath(xmlFileName, "tags");
				XmlNodeList xmlNodeList = xmlNodeByXpath.SelectNodes("group");
				foreach (XmlNode xmlNode in xmlNodeList)
				{
					KryptonHeaderGroup kryptonHeaderGroup = new KryptonHeaderGroup();
					kryptonHeaderGroup.AccessibleName = "";
					kryptonHeaderGroup.AutoSize = true;
					ButtonSpecHeaderGroup buttonSpecHeaderGroup = new ButtonSpecHeaderGroup();
					buttonSpecHeaderGroup.Type = PaletteButtonSpecStyle.ArrowUp;
					kryptonHeaderGroup.ButtonSpecs.AddRange(new ButtonSpecHeaderGroup[]
					{
						buttonSpecHeaderGroup
					});
					kryptonHeaderGroup.Size = new Size(200, 503);
					kryptonHeaderGroup.StateNormal.HeaderPrimary.Content.ShortText.Font = new Font("微软雅黑", 10.5f, FontStyle.Regular, GraphicsUnit.Point, 134);
					kryptonHeaderGroup.Dock = DockStyle.Top;
					kryptonHeaderGroup.HeaderVisibleSecondary = false;
					kryptonHeaderGroup.Location = new Point(0, 2);
					kryptonHeaderGroup.ValuesPrimary.Heading = xmlNode.Attributes["name"].InnerText;
					kryptonHeaderGroup.HeaderStylePrimary = HeaderStyle.Secondary;
					int num = 2;
					foreach (XmlNode xmlNode2 in xmlNode.SelectNodes("tag"))
					{
						KryptonButton kryptonButton = new KryptonButton();
						kryptonButton.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
						kryptonButton.Top = num;
						kryptonButton.Left = 2;
						kryptonButton.Size = new Size(193, 25);
						kryptonButton.Margin = new Padding(20);
						kryptonButton.Text = xmlNode2.Attributes["name"].InnerText;
						kryptonButton.Tag = xmlNode2.SelectSingleNode("value").InnerText;
						kryptonButton.AutoSize = true;
						this.toolTip_0.SetToolTip(kryptonButton, xmlNode2.SelectSingleNode("tips").InnerText);
						kryptonButton.Tag = xmlNode2.SelectSingleNode("value").InnerText;
						kryptonButton.Click += new EventHandler(this.method_1);
						kryptonHeaderGroup.Panel.Controls.Add(kryptonButton);
						num = num + kryptonButton.Height + 1;
					}
					kryptonHeaderGroup.MouseDown += new MouseEventHandler(this.method_2);
					kryptonHeaderGroup.Collapsed = true;
					kryptonHeaderGroup.AutoCollapseArrow = false;
					kryptonHeaderGroup.AllowButtonSpecToolTips = false;
					base.Controls.Add(kryptonHeaderGroup);
				}
			}
			catch (Exception)
			{
			}
		}

		// Token: 0x0600025B RID: 603 RVA: 0x0001DE08 File Offset: 0x0001C008
		private void method_1(object sender, EventArgs e)
		{
			lock (this)
			{
				Clipboard.Clear();
				KryptonButton kryptonButton = sender as KryptonButton;
				Clipboard.SetText(kryptonButton.Tag.ToString());
				MiddleModule.SendMessage(this, new FormInfo
				{
					frmname = "inserttag",
					para = kryptonButton.Tag.ToString()
				});
				Clipboard.Clear();
			}
		}

		// Token: 0x0600025C RID: 604 RVA: 0x0001DE80 File Offset: 0x0001C080
		private void method_2(object sender, MouseEventArgs e)
		{
			KryptonHeaderGroup kryptonHeaderGroup = sender as KryptonHeaderGroup;
			if (kryptonHeaderGroup != null && kryptonHeaderGroup != null)
			{
				kryptonHeaderGroup.Collapsed = !kryptonHeaderGroup.Collapsed;
				kryptonHeaderGroup.ButtonSpecs[0].Type = (kryptonHeaderGroup.Collapsed ? PaletteButtonSpecStyle.ArrowDown : PaletteButtonSpecStyle.ArrowUp);
			}
		}

		// Token: 0x04000279 RID: 633
		private IContainer icontainer_0;

		// Token: 0x0400027A RID: 634
		private ToolTip toolTip_0;
	}
}
